package com.wc.alorithm_luogu.P1100;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/10/8 22:45
 * @description 高低位交换
 * https://www.luogu.com.cn/problem/P1100
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        Main main = new Main();
        String numStr = main.num2Radix32(num);
        String pre = numStr.substring(0, 16);
        String last = numStr.substring(16, 32);
        System.out.println(Long.parseLong(last + pre, 2));
    }

    public String num2Radix32(int num) {
        StringBuilder ans = new StringBuilder();

        while (num != 0) {
            int remainder = num % 2;
            ans.insert(0, remainder);
            num /= 2;
        }
        while (ans.length() != 32) {
            ans.insert(0, '0');
        }

        return ans.toString();
    }
}
